<template>
	<view class="content"> 
		<!-- 列表 --> 
		<view >
			<view style="margin: 30rpx 20rpx;padding: 40rpx 20rpx;background: #FFF;" v-for="(item, index) in dataList" :key="index" @click="activity(item)">
				<view style="height: 200px;margin: 10rpx;">
					<image :src="url + item.cover" style="width: 100%;height: 100%;border-radius: 6rpx;"></image>
				</view>
				<view class="title1">
					{{item.name}}
				</view> 
			</view>
		</view>
	</view> 
</template>

<script> 
	import { getActivityList } from '@/api/maincode/activity' 
	export default {
		data() {
			return {
				current: 0,
				swiperDotIndex: 0, 
				dataList:[],
				noData: false,
				queryParams: {
				    pageNum: 1,
				    pageSize: 10,
				},
				url:this.$fileUrl
			}
		},
		methods: {
			activity(item) {  
			  this.$tab.navigateTo(`/pages/mine/activity/detail?activityId=${item.id}`)
			}, 
			 
			getActivitys() {  
				console.log(this.queryParams);
				getActivityList(this.queryParams).then(res => { 
					if(res.rows == null || res.rows.length < this.queryParams.pageSize ){
						this.noData = true;
						if(this.queryParams.pageNum !=1 ){
							uni.showToast({   title: '已加载全部数据', duration: 2000 });
						}
					}
					this.dataList.push(...res.rows)
				});
			}, 
		},
		onReachBottom() {
			if (!this.noData) {
				this.queryParams.pageNum++;
				this.getActivitys(); // 获取的数据列表
			}
		},
		onLoad: function() {
			this.getActivitys(); 
		}
	}
</script>

<style>
	view {
		font-size: 14px;
		line-height: inherit;
	} 
	.container {
		display: flex;
		flex-direction: column;
	} 
	.title1{
		font-size: 28rpx;
		  margin: 20rpx 10rpx 0 10rpx;
		  display: -webkit-box;
		  -webkit-box-orient: vertical;
		  -webkit-line-clamp: 2;
		  overflow: hidden;
		  text-overflow: ellipsis;
		  font-weight: 600;
		  line-height: 1.5em;
	}
</style>